home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 24 / Amiga Format AFCD24 (Feb 1998, Issue 108).iso / -in_the_mag- / emulation / uae / uae-0.4.3 / readme.programmers < prev    next >
Text File  |  1998-01-20  |  8KB  |  127 lines

  1. You can help to make this program better. If you fix bugs or implement new
  2. features, I'd be grateful if you send me patches. For a list of interesting
  3. projects, and for a brief summary on how UAE works, see below.
  4.  
  5. A few guidelines for anyone who wants to help:
  6. - Please contact me first before you implement major new features. Someone 
  7.   else might be doing the same thing already. This has already happened :-(
  8.   Even if no one else is working on this feature, there might be alternative
  9.   and better/easier/more elegant ways to do it.
  10. - Some coding guidelines.
  11.   * Avoid GNU C extensions by all means. They make your code non-portable.
  12.   * Avoid GNU indentation style by all means. It makes your code unreadable.
  13.   * Try to indent your code nicely. There are editors like JED (I love this
  14.     program) that do this for you automatically.
  15. - If you have access to more than one Unix system, try compiling/running your
  16.   code on all of these. Remember, UAE is supposed to run on the DEC Alpha: so
  17.   don't assume sizeof(char*) == sizeof(int) == sizeof(long)
  18. - If you have more than one Kickstart, try your code with each one.
  19. - Patches are welcome in any form, but diff -u output is preferred. If I get
  20.   whole source files, the first thing I do is to run diff on it. You can
  21.   save me some work here (and make my mailbox smaller).
  22.  
  23. Here's my projects file - sorry, it's HTML.
  24.  
  25. <li>Someone with a 68000 data sheet might check whether all opcodes are
  26.     decoded correctly and whether all instructions really do what they are 
  27.     supposed to do.
  28. <li>Implement all 68020 instructions/addressing modes. [I might do that
  29.     myself for 0.5]
  30. <li>Improve the Kickstart replacement to boot more demos.
  31. <li>Calculating the flags after each instruction is time consuming and usually
  32.     completely unnecessary. Modify gencpu to generate instructions that don't
  33.     set the flags, and have some code in the central loop to decide which
  34.     set of instructions to use. This means additional overhead, of course,
  35.     which might eat any improvements.
  36. <li>Translate Kickstart ROM (or any software) to C code with a slightly
  37.     modified gencpu, and link it to the rest of the emulator. Definitely 
  38.     possible, maybe illegal. Better don't do that for now.
  39. <li>Make a modified gencpu that can generate x86 assembly instead of C. This
  40.     might give a nice speedup. However, the CPU emulation already is the
  41.     fastest part in UAE - screen updates are much more time consuming.
  42. <li>Improve sound emulation.
  43. <li>SVGAlib support could work better (SVGAlib itself could work a lot better,
  44.     too, but that's SEP). Is there any way to use VC 7 like X does?
  45. <li>Snapshots as in CPE. Will need to collect all the variables containing
  46.     important information. Fairly easy, but boring. (Use core dumps instead
  47.     :-)
  48. <li>Make a better X interface - let's have some windows to control the thing.
  49.     I don't think the debugger needs to be in its own window, but some
  50.     graphical interface to eject and insert diskfiles would be nice. [I'm
  51.     trying this right now]
  52. <li>Find out why uae.device doesn't work with Kick 1.3. Not really important,
  53.     no one in his right mind uses it anyway now there is the unixfs.device
  54. <li>Make unixfs.device bootable.
  55. <li>The playfield hardware is the only important part of the Amiga that is 
  56.     not really well documented in the HRM. Write some test programs that
  57.     do all sorts of weird things with the copper (like turning off bitplane 
  58.     DMA during a line, and turning it directly on again: VERY interesting
  59.     result) and try to emulate this perfectly.
  60. <li>Figure out a diskfile format that supports every possible non-standard
  61.     format.
  62. <li>Translate basic blocks of m68k instructions to intermediate code that is 
  63.     interpreted instead of the actual code. Optimize it of course.
  64.     (Not sure whether it would really be faster. But ARDI's Executor does
  65.     a splendid job on translation. This should really help even if the target
  66.     code isn't native).
  67. <li>ECS support. I'm a little against this one. There's nothing really good
  68.     about ECS except maybe 2MB chip and big blits. SuperHires will look awful.
  69.     Productivity mode is not needed, since we can use interlace mode without
  70.     flicker. This has a higher resolution than Productivity, and more colors.
  71.     <br>However, if someone really wants ECS...
  72. <li>Implement 68882 FPU.
  73. <li>Implement 68551 MMU. (anyone got info on that?)
  74. <li>Implement AGA support. First task: Find documentation for it (I do have
  75.     some articles, but it's not very much).
  76. <li>Reimplement Amiga OS. (Well-behaved) Amiga programs could then be made
  77.     to use the X Window System as a "public screen". Of course, not all the
  78.     OS would have to be re-done, only Intuition/GFX.<br>
  79.     An AWM window manager would also be nice for a start :-)
  80. <li>Translate instructions on the fly to native code, like Executor does.
  81.     I'll NEVER try that one myself.
  82. <li>Find some extremely clever way to optimize screen updates to use another
  83.     strategy than brute force, but _without_
  84.     compromising compatibility. I think this is impossible, but we heard that
  85.     word before.
  86.  
  87. How it works
  88.  
  89. Let's start with the memory emulation. All addressable memory is split into
  90. banks of 64K each. Each bank can define custom routines accessing bytes, 
  91. words, and longwords. All banks that really represent physical memory just 
  92. define these routines to write/read the specified amount of data to a chunk 
  93. of memory. This memory area is organized as an array of WORDs, which means 
  94. that those parts of the emulator that want to access memory in a linear 
  95. fashion can get a (WORD *) pointer and use it to circumvent the overhead of
  96. the put_word() and get_word() calls. That is done, for example, in the
  97. pfield_doline() function which handles screen refreshes.
  98. Memory banks that represent hardware registers (such as the custom chip bank
  99. at 0xDF0000) can trap reads/writes and take any necessary actions.
  100. In some places, this scheme is abused: The uae.device and unixfs.device are
  101. stored in a segment at 0xF00000 containing a ROMtag structure, so it is
  102. recognized at bootup. Since this is a ROM area, writes shouldn't occur
  103. normally and are therefore used to trap into emulation routines for these
  104. devices.
  105.  
  106. To provide a good emulation of graphical effects, only one thing is vital:
  107. Copper and playfield emulation have to be kept absolutely synchronous. If the
  108. copper writes to (say) a color register in a specific cycle, the playfield 
  109. hardware needs to use the new information in the next word of data it 
  110. processes.
  111. UAE 0.1 used to call routines like do_pfield() and do_copper() each time the
  112. CPU emulator had finished an instruction. That was one of the reasons why it
  113. was so slow. Recent versions try to draw complete scanlines in one piece. This
  114. is possible if the copper does not write to any registers affecting the
  115. display during that scanline. Therefore, drawing the line is deferred until
  116. the last cycle of the line. If the copper writes to a hardware register before
  117. that, the function pfield_may_need_update() is called and this one determines
  118. whether it should fall back to the cycle-for-cycle approach. This is very
  119. rarely needed, mainly for copper-plasma effects and such, and the general case
  120. is much faster.
  121.  
  122. The CPU emulator no longer has to call all sorts of functions after each
  123. instruction. Instead, it keeps a list of events that are scheduled (timer
  124. interrupts, hsync and vsync events) and their "arrival time". Only the time
  125. for the next event is checked after each CPU instruction. If it's higher than
  126. the current cycle counter, the CPU can continue to execute.
  127.